Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added websockets for sending logs if available #489

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rc10house
Copy link
Contributor

Adds functionality to main.ts to check if the provided config.url is running a WebSocket server. If so, we upgrade the connection to send data over WebSockets and use this for sending all logs. If not, we send data with the existing REST functionality. I also added a test/example WebSockets server examples/ws-server.js.

Note: WebSockets will not run when using Jest to test currently, so the application skips attempting to create a WebSockets connection if it detects running in a test environment (headless browser).

Closes: #444

src/main.ts Show resolved Hide resolved
src/main.ts Show resolved Hide resolved
example/test-client.ts Outdated Show resolved Hide resolved
@rc10house rc10house requested a review from Jyyjy August 21, 2024 20:23
@rc10house
Copy link
Contributor Author

Had to separate some tests to avoid websockets being ran from within jsdom environment. Also had to add some helper methods for manually turning on/off websockets for testing purposes.

@Jyyjy
Copy link
Contributor

Jyyjy commented Aug 29, 2024

You can add another webserver to test/e2e/playwright.config.ts and specify which webserver to use for different projects. Set existing projects to use the existing webserver, and create a new project with a websocket server.

I would set http and websockets to different ports within the same server and specify "reuseExistingServer: True"

Relevant docs:
https://playwright.dev/docs/test-webserver

@EandrewJones
Copy link
Contributor

@rc10house Bumping this. Would be nice to get this over the finish line if you have time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature(streaming): support streaming logs with websocket
3 participants